<?php
namespace common\logic;
use common\models\AdverttypeModel;
use yii\db\ActiveQuery;
use yii\helpers\ArrayHelper;
class AdverttypeLogic extends Logic
{
	/**
     * @return ActiveQuery
     */
    protected function _getActiveQuery()
    {
        return AdverttypeModel::find();
    }
    
	public function AdverttypeSave(AdverttypeModel $model){
        $rs = $model->save();
        return $rs;
	}
	
	public function getTypeByName($typename)
    {
    	$Adverttype = $this->getQuery(['typename' => $typename])->all();
        return $Adverttype;
    }
	
	public function getTypeByNameId($typename,$tid)
    {
    	$Adverttype = $this->getQuery(["typename"=>$typename])->andWhere("tid<>$tid")->all();
        return $Adverttype;
    }
	
	
	public function getAll(){
        return $this->_all();
    }
}
?>